<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            function clone(parent, child) {
                child.prototype = Object.create(parent.prototype);
                child.prototype.constructor = child;
            }

            function Parent(name, age) {
                this.name = name;
                this.age = age;
            }

            Parent.prototype.getName = function () {
                return this.name;
            };

            function Child(name, age, friends) {
                Parent.call(this, name, age);
                this.friends = friends;
            }
            clone(Parent, Child);

            Child.prototype.getFriends = function () {
                return this.friends;
            };

            let child1 = new Child('zs', 19, 'wangwu');
            console.log(child1);
        </script>
    </body>
</html>
